package com.shcz.migu.observe.audio_observe;


import com.shcz.migu.observe.base_observe.IObserver;

/**
 * Created by Administrator on 2015/10/13.
 */
public class AudioObserverService {
    private static AudioObserverService mService;
    private AudioObserverNode mObserverNode;

    public static AudioObserverService getInstance(){
        if(null == mService){
            synchronized (AudioObserverService.class){
                if (null == mService){
                    mService = new AudioObserverService();
                }
            }
        }
        return  mService;
    }

    private AudioObserverService(){
        initService();
    }

    private void initService() {
        mObserverNode = new AudioObserverNode();
    }

    public void registerObserver(IObserver observer){
        mObserverNode.registerObserver(observer);
    }

    public void unRegisterObserver(IObserver observer){
        mObserverNode.unRegisterObserver(observer);
    }
    public void setData(Object data){
        mObserverNode.setData(data);
    }

    public void notifyDataChanged(int requestCode){
        mObserverNode.setRequestCode(requestCode);
        mObserverNode.notifyDataChanged();
    }
}
